--- ./src/eidete.vala.orig	2014-04-21 05:22:03.000000000 +0000
+++ ./src/eidete.vala	2014-05-29 11:24:36.000000000 +0000
@@ -517,6 +517,19 @@
 			});
 		}
 
+		private string get_cpu_nb (string data){
+
+			string[] tokens;
+			string cores = null;
+
+			tokens = data.split (":");
+			if (tokens.length == 2) {
+				cores = tokens[1].strip ();
+			}
+
+			return cores;
+		}
+
 		public void record () {
 			if (settings.keyview || settings.clickview || settings.mouse_circle) {
 				keyview = new Eidete.Widgets.KeyView (settings.keyview, settings.clickview, settings.mouse_circle, settings.mouse_circle_color);
@@ -548,14 +561,14 @@
 			//audio bin
 			this.audiobin = new Gst.Bin ("audio");
 			try{
-				audiobin = (Gst.Bin)parse_bin_from_description ("pulsesrc name=\"audiosrc\" !
+				audiobin = (Gst.Bin)parse_bin_from_description ("osssrc name=\"audiosrc\" !
 				                  audioconvert ! audioresample ! audiorate ! vorbisenc ! queue", true);
 			}catch (Error e){ stderr.printf ("Error: %s\n", e.message);}
 
 
 			string cores;
 			try{
-				Process.spawn_command_line_sync ("cat /sys/devices/system/cpu/online", out cores);
+				Process.spawn_command_line_sync ("/sbin/sysctl hw.ncpu", out cores);
 			}catch (Error e){warning (e.message);}
 
 			//configure
@@ -571,7 +584,9 @@
 			videobin.get_by_name ("encoder").set  ("quality", 8.0);
 			videobin.get_by_name ("encoder").set  ("speed", 6);
 			videobin.get_by_name ("encoder").set  ("max-keyframe-distance", 150);
-			videobin.get_by_name ("encoder").set  ("threads", int.parse (cores.substring (2)));
+			if (cores != null) {
+				videobin.get_by_name ("encoder").set  ("threads", int.parse (get_cpu_nb (cores)));
+			}
 
 
 			if (pipeline==null||muxer==null||sink==null||videobin==null||audiobin==null){
